﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace WQDSkin.Forms.Controls
{
    public class WQDTreeView:TreeView
    {
        [Description("图标"), Category("WQDSkin")]
        public Geometry Icon
        {
            get { return (Geometry)GetValue(IconProperty); }
            set { SetValue(IconProperty, value); }
        }
        public static readonly DependencyProperty IconProperty =
            DependencyProperty.Register("Icon", typeof(Geometry), typeof(WQDTreeView), new PropertyMetadata(null));
         
        public object SelectData
        {
            get
            {
                if (this.SelectedItem != null && this.SelectedItem is TreeViewItem)
                {
                    TreeViewItem item = ((TreeViewItem)this.SelectedItem);
                    return item.DataContext;
                }

                return null;
            }
        }
 
        protected override DependencyObject GetContainerForItemOverride()
        {
            return new WQDTreeViewItem(); 
        }
    }
}
